﻿//===================================================================
// 西交通开发框架-XCI.Parent 2019 版权所有     
//===================================================================
using System;
using System.ComponentModel.DataAnnotations;
using XCI.Core;

namespace XCI.Sys.Model
{
    /// <summary>
    /// 系统机构
    /// </summary>
    [ApiModel(Caption = "系统机构")]
    public class SysDept
    {
        /// <summary>
        /// 机构主键
        /// </summary>
        [Display(Name = "机构主键")]
        [ApiModelProperty(PrimaryKey = true)]
        public string Id { get; set; }

        /// <summary>
        /// 机构上级主键
        /// </summary>
        [Display(Name = "机构上级主键")]
        [ApiModelProperty(ParentKey = true)]
        public string ParentId { get; set; }

        /// <summary>
        /// 机构
        /// </summary>
        [Display(Name = "机构")]
        public string NameCode => $"{Name}({Code})";

        /// <summary>
        /// 机构名称
        /// </summary>
        [Required(ErrorMessage = "请输入机构名称")]
        [StringLength(100, ErrorMessage = "机构名称不能超过100个字符")]
        [Display(Name = "机构名称"),]
        public string Name { get; set; }

        /// <summary>
        /// 机构编码
        /// </summary>
        [Required(ErrorMessage = "请输入机构编码")]
        [StringLength(100, ErrorMessage = "机构编码不能超过100个字符")]
        [Display(Name = "机构编码")]
        public string Code { get; set; }

        /// <summary>
        /// 机构简拼
        /// </summary>
        [StringLength(100, ErrorMessage = "机构简拼不能超过100个字符")]
        [Display(Name = "机构简拼")]
        public string Spell { get; set; }

        /// <summary>
        /// 机构类型
        /// </summary>
        [StringLength(100, ErrorMessage = "机构类型长度不能超过100")]
        [Display(Name = "机构类型")]
        public string Category { get; set; }

        /// <summary>
        /// 机构性质
        /// </summary>
        [StringLength(100, ErrorMessage = "机构性质长度不能超过100")]
        [Display(Name = "机构性质")]
        public string Nature { get; set; }

        /// <summary>
        /// 机构负责人主键
        /// </summary>
        [Display(Name = "机构负责人主键")]
        public string LeaderId { get; set; }

        /// <summary>
        /// 机构负责人姓名
        /// </summary>
        [Display(Name = "机构负责人姓名")]
        public string LeaderName { get; set; }

        /// <summary>
        /// 排序路径
        /// </summary>
        [Display(Name = "序号"), ApiModelProperty(PathKey = true)]
        public int? Path { get; set; }

        /// <summary>
        /// 状态 [true-启用, false-禁用]
        /// </summary>
        [Display(Name = "状态")]
        public bool Status { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注不能超过500个字符")]
        [Display(Name = "备注")]
        public string Remark { get; set; }

        /// <summary>
        /// 复制对象
        /// </summary>
        public SysDept Clone()
        {
            return (SysDept)MemberwiseClone();
        }
    }
}
